import { Controller, Get, Body, Put, Query } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { util_ApiResponse_Base } from '@/common/util/apiResponse';
import { util_Index_ReturnContent } from '@/common/util/index';
import { CashBack_Find_Dto, CashBack_OrderListFind_Dto, CashBack_Pass_Dto } from './assets/cashBack.dto';
import { CashBack_Service } from './cashBack.service';

@Controller('/adm/cashBack')
@ApiTags('cashBack 返现')
export class CashBack_Controller {
  constructor(private readonly cashBack_Service: CashBack_Service) {}

  @Get('list')
  @util_ApiResponse_Base({
    dataType: 'dataType_list',
    summary: '返现列表',
  })
  async cashBack_FindByPage(@Query() query: CashBack_Find_Dto) {
    return util_Index_ReturnContent(await this.cashBack_Service.cashBack_FindByPage(query));
  }

  @Put('/pass')
  @util_ApiResponse_Base({
    dataType: 'dataType_string',
    description: '手动打款成功',
    summary: '手动打款',
  })
  async cashBack_Pass(@Body() body: CashBack_Pass_Dto) {
    return util_Index_ReturnContent(await this.cashBack_Service.cashBack_Pass(body));
  }

  @Get('/orderList')
  @util_ApiResponse_Base({
    dataType: 'dataType_list',
    summary: '该返现记录对应的订单',
  })
  async cashBack_FindOrderListByPage(@Query() query: CashBack_OrderListFind_Dto) {
    return util_Index_ReturnContent(await this.cashBack_Service.cashBack_FindOrderListByPage(query));
  }

  @Get('/static')
  @util_ApiResponse_Base({
    dataType: 'dataType_object',
    summary: '返现管理 数据统计',
  })
  async cashBack_Static(@Query() query: CashBack_Find_Dto) {
    return util_Index_ReturnContent(await this.cashBack_Service.cashBack_Static(query));
  }
}
